Reading material: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
Array在JS裏面,有幾個重點特色:
let array = []
array = [0.1, 2, "345", {six: 6}, [{key: 6},{key: 7},{key: 8}], 9]
var types_of_array = []
for (let i = 0; i < array.length; i++) {
types_of_array.push(typeof(array[i]))
}
console.log(types_of_array)
console.log(types_of_array.at(-1))
shallow copy: 把新物件 pointer 指的位置,指向存放舊物件資料的地方,可能會發生update舊物件資料時,影響到舊物件的結構